import request from '@/utils/request'

// 查询打印模版列表
export function listPrintScheme(query) {
  return request({
    url: '/pos/print/list',
    method: 'get',
    params: query
  })
}

// 查询打印模版详细
export function getPrintScheme(schemeId) {
  return request({
    url: '/pos/print/' + schemeId,
    method: 'get'
  })
}

// 新增打印模版
export function addPrintScheme(data) {
  return request({
    url: '/pos/print',
    method: 'post',
    data: data
  })
}

// 修改打印模版
export function updatePrintScheme(data) {
  return request({
    url: '/pos/print',
    method: 'put',
    data: data
  })
}

// 删除打印模版
export function delPrintScheme(schemeId) {
  return request({
    url: '/pos/print/' + schemeId,
    method: 'delete'
  })
}

// 验证打印模版
export function validatePrintScheme(data) {
  return request({
    url: '/pos/print/validate',
    method: 'post',
    data: data
  })
}

// 获取打印模版预览
export function getPrintSchemePreview(schemeId, previewData) {
  return request({
    url: '/pos/print/preview/' + schemeId,
    method: 'post',
    data: previewData
  })
}

// 复制打印模版
export function copyPrintScheme(schemeId, newSchemeName) {
  return request({
    url: '/pos/print/copy/' + schemeId,
    method: 'post',
    data: { schemeName: newSchemeName }
  })
}

// 设置默认打印模版
export function setDefaultPrintScheme(schemeId, schemeType) {
  return request({
    url: '/pos/print/setDefault',
    method: 'post',
    data: { schemeId: schemeId, schemeType: schemeType }
  })
}

// 导出打印模版
export function exportPrintScheme(query) {
  return request({
    url: '/pos/print/export',
    method: 'post',
    data: query
  })
}
